package servlet;


import bean.Role;
import service.RoleService;
import service.impl.RoleServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(urlPatterns = "/power/user/getRoleList")
public class GetRoleListServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //查询角色列表的方法

        RoleService service = new RoleServiceImpl();

        List<Role> list = service.getList();

        //存角色数据
        req.setAttribute("rlist",list);
        //数据转发到新增页面
        req.getRequestDispatcher("add.jsp").forward(req,resp);

    }
}
